#include "startdialog.h"
#include "mainwindow.h"
#include "plugins/gsplugin.h"

#include <QApplication>
#include <QDesktopWidget>
#include <QMessageBox>
#include <QString>
#include <QStyleFactory>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
//    QCoreApplication::addLibraryPath("./lib");
    //--------------------Loading Plugins-------------------------
    QList<GSPlugIn*> plugInSet;
    StartDialog sd;
    sd.move((QApplication::desktop()->width() - sd.width())/2,
            (QApplication::desktop()->height() - sd.height())/2);
    if (sd.exec() != QDialog::Accepted)
    {
        //loading plugin failure
        QMessageBox::about(NULL, "Notification!",
                       "Loading PlugIns Failure!" );
    }
    else
    {
        //loading plugin success
        plugInSet = sd.getPlugIns();
    }
    sd.close();

    //-------------------Loading MainWindow----------------------
    MainWindow pw(plugInSet);
    pw.move((QApplication::desktop()->width() - pw.width())/2,
            (QApplication::desktop()->height() - pw.height())/2);
    pw.showMaximized();

    a.setStyle(QStyleFactory::create("gtk"));
    a.setWindowIcon(QIcon(":/images/logo.png"));
    //gtk windows macintosh windowsxp windowsvista fusion
    int ret = a.exec();
    return ret;
}
